// Demonstrates the Swing JApplet /* * * */ import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Simple2 extends JApplet { public void init() { Container contentPane = getContentPane(); JLabel label = new JLabel ("This is the Simple2 Swing Applet"); contentPane.add (label); } public static void main (String[] args) { JFrame f = new JFrame ("Simple2"); Simple2 s2 = new Simple2(); s2.init(); f.getContentPane().add(s2); f.addWindowListener (new WindowEventHandler()); f.setSize (200, 100); f.show(); } } class WindowEventHandler extends WindowAdapter { public void windowClosing (WindowEvent e) { System.exit(0); } }